package  com.NeuglsWorkStudio.UI.FormElement.Component
{
	import com.NeuglsWorkStudio.UI.Buttons.TEffectedButtonEx;
	import com.NeuglsWorkStudio.UI.FormElement.Config.TButtonConfig;
	import com.NeuglsWorkStudio.UI.FormElement.Config.TConfig;
	

	public class TButton extends TComponent
	{
		private var _FButton:TEffectedButtonEx;
		private var _FEnabled:Boolean=true;
		
		public function TButton(AConfig:TConfig)
		{
			super(AConfig);
		}
		
		public function get Enabled():Boolean
		{
			return _FEnabled;
		}

		public function set Enabled(value:Boolean):void
		{
			_FEnabled = value;
			_FButton.Enabled=value;
		}

		private function ButtonConfig():TButtonConfig{
			return _FConfig as TButtonConfig;
		}
		
		override protected function Init():void{
			super.Init();
			_FButton=new TEffectedButtonEx(ButtonConfig().Caption,false,ButtonConfig().BaceColor);
			_FButton.OnClick=ButtonConfig().OnClick;
			_FButton.Enabled=ButtonConfig().Enabled;
			this.addChild(_FButton);
		}
	}
}